Open Google Calendar PageMenu
2021-05-01
16:50:54 /u/1だとなぜかMobile appを開いてくれないので、renderにした
code:script.js
const zero = (n) => ${n}.padStart(2, "0");
scrapbox.PageMenu.addMenu({
title: 'Open Google Calendar',
onClick: () => {
const now = new Date();
const [
,
years,
months,
date,
] = scrapbox.Page.title.match(/日刊記録sheet (\d{4})-(\d{2})-(\d{2})/) ?? [
,
now.getFullYear(),
now.getMonth() + 1,
now.getDate(),
];
/mobile/i.test(navigator.userAgent) ? "render" : "u/1"
}/r/week/${zero(years)}/${zero(months)}/${zero(date)}`);
},
});
別のpage menuに入れるとき用
code:pageItem.js
export function addGoogleCalendarItem(name) {
scrapbox.PageMenu(name).addItem({
title: 'Open Google Calendar',
});
}